using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Reflection;
using System.Data.Linq;
using DataObject.Core;
using DataObject.Database;
using DataObject.Model;

namespace DataObject.DataAccess
{
    public partial class ReservationExtraDAO : DataBaseProcessBase<ReservationExtraDAO, OBSDataContext>
    {
        public static ReservationExtraDAO CreateInstant()
        {
            return new ReservationExtraDAO();
        }

        public IList<ReservationExtra> GetExtraServices(Guid reservaiontID)
        {
            IList<ReservationExtra> list = null;
            using (var db = new OBSDataContext(base.connectionString))
            {
                db.DeferredLoadingEnabled = false;
                DataLoadOptions dlo = new DataLoadOptions();
                dlo.LoadWith<Reservation>(b => b.ReservationExtras);
                db.LoadOptions = dlo;

                var query = db.ReservationExtras.Where(x => x.ReservationID == reservaiontID);
                if (query != null)
                {
                    list = query.ToList();
                }

            }
            return list;
        }

    }
}
